package com.bupt.server.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bupt.server.entity.Room;
import org.apache.ibatis.annotations.*;

@Mapper
public interface RoomMapper extends BaseMapper<Room> {
    @Insert("insert into room (room_id,customer_id, password, room_type,status) values (#{room_id},#{customer_id}, #{password}, #{room_type},1);")
    int checkInInsertRoom(@Param("room_id") int room_id,@Param("customer_id") String customer_id, @Param("password") String password, @Param("room_type") String room_type);

    @Select("select * from room where room_id = #{room_id} and password = #{password}")
    Room enterRoomCheck(@Param("room_id") int room_id,@Param("password") String password);

    @Select("select * from room where room_id = #{room_id}")
    Room checkRoomInfo(@Param("room_id") int room_id);

    @Update("update room set speed = #{speed} where room_id = #{room_id}")
    int updateRoomSpeed(@Param("room_id") int room_id,@Param("speed") String speed);

    @Update("update room set target_temperature = #{target_temperature} where room_id = #{room_id}")
    int updateRoomTargetTemp(@Param("room_id") int room_id,@Param("target_temperature") float target_temperature);

    @Update("update room set ac_status = #{ac_status} where room_id = #{room_id}")
    int updateRoomACStatus(@Param("room_id") int room_id,@Param("ac_status") String ac_status);
}
